<!DOCTYPE html>
<html>

<head>
    <title>
        <%- title %>
    </title>
    <% include layout/lib.ejs %>
    <link rel="stylesheet" type="text/css" href="/css/donation.css" />
</head>

<body>
        <% include layout/header.ejs %>

        <div class="donationBox">
            <div class="donationMain">
                <div class="donationMainLeft">
                        <div class="donationZhifuBox">
                                <div class="donationZhifuItem"><img src="/image/ed-40.png" /></div>
                                <div class="donationZhifuItem"><img src="/image/ed-46.png" /></div>
                            </div>
                            <div class="zhifuDesc" style="border-bottom:1px solid #eee;padding-bottom:20px;">非常感谢您对Easy-D集合开发框架的支持和认可，我们将继续为您提供更好的产品服务</div>
                            <div class="zhifuDesc" style="border-bottom:1px solid #eee;padding-bottom:20px;"> 我们将保证将捐赠用于以下内容：
                                <p>1. 继续用于完善和开发Easy-D集合开发框架</p>
                                <p>2. 进行宣传Easy-D集合开发框架，鼓励更多的维护者参与进来</p>
                                <p>3. 设置框架公共服务开发活动，为优秀开发者提供一定的补助</p>
                                <p>4. 作为各类Easy-D活动基金，完善社区体制</p>
                                <p>5. 给框架维护者们过节买箱牛奶补补，以免挂掉</p>
                                <p>6. 可能的话找几个小姐姐鼓励一下维护者们，让他们继续好好努力维护</p>
                                <p>(备注：最后两条纯属扯犊子)</p>
                            </div>
                            <div class="zhifuDesc">请留下您宝贵的信息，我们将对您的捐赠进行公布：</div>
                            <div class="donationZhifuInfo">
                                <div class="donationZhifuInput">
                                    <i class="fa fa-address-book-o fa-lg"></i>
                                    <input type="text" id="ed_name" placeholder="您的个人姓名/公司名称" />
                                </div>
                                <div class="donationZhifuInput" style="margin-top:20px;">
                                    <i class="fa fa-cny fa-lg" style="left:13px;"></i>
                                    <input type="text" id="ed_money" placeholder="您输入您的捐赠金额，方便我们进行核对" />
                                </div>
                                <div class="donationZhifuTextArea">
                                    <textarea id="ed_desc"  placeholder="您对我们的宝贵意见和建议"></textarea>
                                </div>
                                <div class="codeData" style="margin-top:20px;">
                                    <input type="text" id="code" style="width:150px;height:57px;outline: none;float:left;margin-right:10px;padding-left:15px;padding-right:15px;border:none;border:1px solid #eee;" name="code" placeholder="请输入验证码" /> <img id="codeImage"  style="position:relative;top:0px;border:1px solid #eee;padding-bottom:5px;" src="/common/createCode">
                                </div>
                                <div class="donationZhifuBtn">提交记录</div>
                            </div>
                </div>
                <div class="donationMainRight">
                    <div class="donationRecordTitle">捐赠记录：<span>已捐助总额：￥<%- moneyCount %></span></div>
                    <div class="donationRecordContent">
                        <% for(var i=0;i<donationData.length;i++){ %>
                        <div class="donationRecordItem">
                            <div class="donationName"><strong><%- donationData[i].d_name %></strong><b>￥<%- donationData[i].d_money %></b><span style="float:right;"><a style="text-decoration: none;color:green" href="<%- donationData[i].d_image %>" target="_blank">查看截图</a></span><span style="float:right;color:#999;"><%- common.dateFormat("yyyy-MM-dd hh:mm",donationData[i].d_create_time) %></span></div>
                            <div class="donationDesc"><%- donationData[i].d_desc %></div>
                        </div>
                        <% } %>
                    </div>
                </div>
                
            </div>
        </div>

        <% include layout/footer.ejs %>

</body>
<script>
    $(function(){

        $(".donationZhifuBtn").click(function(){

            var ed_name  = $("#ed_name").val();
            var ed_money = $("#ed_money").val();
            var ed_desc  = $("#ed_desc").val();
            var code     = $("#code").val();
            

            //验证参数
            if(str_trim(ed_name).length <= 0){
                POP.warning("验证提示","名称不能为空");
                return;
            }

            var reg = /^[0-9]*$/;
            if(!reg.test(ed_money)){
                POP.warning("验证提示","金额必须为数字");
                return;
            }

            if(parseFloat(ed_money) > 9999){
                POP.warning("验证提示","金额数不能大于9999");
                return;
            }

            if (str_trim(code).length <= 0) {
                POP.warning("验证提示", "验证码不能为空");
                return;
            }

            var params = {
                ed_name  : ed_name,
                ed_money : ed_money,
                ed_desc  : ed_desc,
                code     : code
            }

            POP.startLoading();

            HTTP.post("/user/addDonation", params, (rs) => {

                POP.endLoading();
                POP.success("提示信息", "恭喜您，捐赠信息提交成功");

                setTimeout(() => {

                    //清空内容
                    $("#ed_name").val("");
                    $("#ed_money").val("");
                    $("#ed_desc").val("");
                    location.reload();

                }, 1500);

            })


        })

    });
</script>
</html>


